qx.Class.define("HersPOS.HersPOS",
{
  extend : qx.ui.container.Composite,
  events :
  {
    "reload"          : "qx.event.type.Event",
    "changeParam"     : "qx.event.type.Data",
    "show_hide_right" : "qx.event.type.Data"
  },

  construct : function()
  {
    this.base(arguments);
    var layout = new qx.ui.layout.VBox();
    layout.setSeparator("separator-vertical");
    this.setLayout(layout);
    this.setPadding(0);
    this.setDecorator(null);
    var main_pane = new qx.ui.splitpane.Pane("horizontal")  //.set({width: 450});
    var footer = new HersPOS.Footer();
    this.LeftPart = new HersPOS.LeftComp();
    this.RScroller = new qx.ui.container.Scroll();

    //     main_pane.setWidth(Math.floor(qx.bom.Viewport.getWidth() / 8 ));
    //     main_pane.setDecorator(null)
    //     left_pane_vert.setDecorator(null);
    //     this.left_pane_vert.add(this.botPart, 1);
    //     this.mid_vpane = new qx.ui.splitpane.Pane('vertical');
    //     this.mid_vpane.setDecorator(null)
    //     this.mid_topPart = new HersPOS.MidDesk();
    //     this.mid_botPart = new HersPOS.MidInfoPart();
    //     this.mid_vpane.add(this.mid_topPart, 1);
    //     this.mid_vpane.add(this.mid_botPart, 0);
    main_pane.add(this.LeftPart, 0);

    //     main_pane.add(this.mid_vpane, 1);
    this.midComp = new HersPOS.MidComp();

    this.RScroller.add(this.midComp);
    main_pane.add(this.RScroller, 1);

    hdr = new HersPOS.Header();
    this.tool_bar = new HersPOS.ToolBar();
    this.add(hdr);
    this.add(this.tool_bar);
    this.add(main_pane, { flex : 1 });
    this.add(footer);
    var url = "/HersPOS/default/list_data.json";
    var datelist_store = new qx.data.store.Json(url);
    datelist_store.bind("model", this.LeftPart.folderTree, "model");

    this.LeftPart.addListener("changeParam", function(e)
    {
      this.midComp.LeftSalesTable.SalesTable.apply_param(e.getData());
      this.midComp.LeftSalesTable.SalesBar.reload_totals(e.getData());
    },
    this);
  }

  //     this.LeftPart.folderTree.addListener("changeSelection",function(e){
  //
  //       param = e.getData()
  //       console.log(param)
  // },this)

});
